﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PraiseSystem.Models
{
    public class Receiver
    {
        public string ReceiverID { get; set; }
        public string Name { get; set; }
        public virtual ICollection<Praise> ReceivedPraises { get; set; }
    }

    public class ReceiverMap : EntityTypeConfiguration<Receiver>
    {
        public ReceiverMap()
        {
            ToTable("tb_Receiver");
            HasKey(r => r.ReceiverID);
            Property(p => p.Name).IsRequired().HasMaxLength(10);
            HasMany(u => u.ReceivedPraises).WithMany(p => p.Receivers).Map(m => m.ToTable("User_Praise_Mapping"));
        }
    }
}
